package com.ocom.company.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ocom.common.entity.company.EntityDockList;
import com.ocom.common.enums.DataSourceEnum;
import com.ocom.company.dao.IDaoDockList;
import com.ocom.company.service.DockListService;
import com.ocom.mysql.aspect.DataSourceAspect;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

@Service
public class DockListServiceImpl extends ServiceImpl<IDaoDockList, EntityDockList> implements DockListService {


    @Override
    @DataSourceAspect(type = DataSourceEnum.MAIN_DB)
    public EntityDockList getDockList(String dockCode) {
        QueryWrapper<EntityDockList> queryWrapper = Wrappers.query();
        queryWrapper.eq("dock_code", dockCode);

        queryWrapper.last("limit 1");
        return this.getOne(queryWrapper);
    }
}
